extends Sprite2D

var SD = 100
var JD = 0

@export var yw : PackedScene


func _process(delta: float) -> void:
	position += SD * Vector2.RIGHT.rotated(deg_to_rad(JD)) * delta 
	

func YD(jd : float):
	print("获取开火指令-角度" ,jd)
	JD = jd
	rotation = deg_to_rad(jd + 90)

func _on_area_2d_area_entered(area: Area2D) -> void:
	if area.is_in_group("敌人"):
		var _yw = yw.instantiate()
		_yw.position = position
		if get_parent():
			get_parent().add_child(_yw)
		queue_free()
